Imports pixolut.BizBlox

Public Class StudentCollection
    Inherits DOCollection

'START BizBlox Generated Code : Do not remove or alter this comment
'Last Updated : Tuesday, 24 August 2004 4:01:21 PM
'BizBlox Version : 0.9.1.22818
#Region "BizBlox Generated Code"

    Sub New()
        MyBase.New(New DOFactory(New Student))
    End Sub

    'to typecast your item() property
    Default Public Shadows ReadOnly Property Item(ByVal i As Integer) As Student
        Get
            Return CType(MyBase.Item(i), Student)
        End Get
    End Property

#End Region
'END BizBlox Generated Code : Do not remove or alter this comment


    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Example pattern for usage of standard SQLBuilder API calls.
    ''' </summary>
    ''' <param name="name"></param>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[cinj]	28/07/2004	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Public Sub FindByStudentName(ByVal name As String)
        Dim mySql As SQLBuilder = MyBase.GetSqlBuilder()
        mySql.addWhere(Student.Columns.Name, name)
        MyBase.find(mySql)
    End Sub

    ''' -----------------------------------------------------------------------------
    ''' <summary>
    ''' Example use of the SearchBuilder in a finder method.
    ''' </summary>
    ''' <param name="SearchTerm"></param>
    ''' <remarks>
    ''' </remarks>
    ''' <history>
    ''' 	[cinj]	28/07/2004	Created
    ''' </history>
    ''' -----------------------------------------------------------------------------
    Public Sub SearchByStudentName(ByVal SearchTerm As String)
        Dim mySql As SQLBuilder = MyBase.GetSqlBuilder()
        If SearchTerm <> "" Then
            Dim sb As New SearchBuilder(SearchTerm)
            mySql.addSearch(Student.Columns.Name, sb)
        End If
        MyBase.Find(mySql)
    End Sub

    Public Sub FindByNameEmailAge(ByVal name As String, ByVal email As String, ByVal ageLower As Integer, ByVal ageUpper As Integer)
        Dim mySql As SQLBuilder = MyBase.GetSqlBuilder
        If name.Length > 0 Then
            Dim sb1 As New SearchBuilder(name)
            mySql.addSearch(Student.Columns.Name, sb1)
            mySql.addAnd()
        End If
        If email.Length > 0 Then
            Dim sb2 As New SearchBuilder(email)
            mySql.addSearch(Student.Columns.Email, sb2)
            mySql.addAnd()
        End If
        mySql.AddWhereGTE(Student.Columns.Age, ageLower)
        mySql.addAnd()
        mySql.AddWhereLTE(Student.Columns.Age, ageUpper)
        MyBase.Find(mySql)
    End Sub

End Class




